package ex;

import jdk.nashorn.internal.runtime.OptimisticReturnFilters;
import sun.security.util.Length;

import javax.lang.model.type.ArrayType;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class H13 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入游戏人数: ");
        int num = sc.nextInt();

        if (num < 12) {
            System.out.println("超出游戏人数范围！");
        } else if (num > 18) {
            System.out.println("超出游戏人数范围！");
        } else if (num==12) {
            String[] card1 = {"狼人", "村民", "村民", "村民", "村民", "预言家", "女巫", "丘比特", "守护", "猎人", "村长"};
            //去掉三个相同的狼人和盗贼，进行排序
            Random r = new Random();
            for (int i = 0; i < 110; i++) {
                int r1 = r.nextInt(11);
                String temp = card1[r1];
                card1[r1] = card1[0];
                card1[0] = temp;
            }
            String[] a = new String[3];
            //a表示底牌
            for (int i = 0; i <= 2; i++) {
                a[i] = card1[card1.length - 1 - i];
                System.out.println("三张底牌为: " + a[i]);
            }

            //将card1表复制到cards2表中,
            String[] cards2 = Arrays.copyOf(card1, card1.length + 1);
            cards2[cards2.length - 1] = "盗贼";
            cards2[cards2.length - 2] = "狼";
            cards2[cards2.length - 3] = "狼";
            cards2[cards2.length - 4] = "狼";
            for (int i = 0; i < 110; i++) {
                int r1 = r.nextInt(12);
                String temp = cards2[r1];
                cards2[r1] = cards2[0];
                cards2[0] = temp;
            }
            String[] b = new String[12];
            for (int i = 0; i < 12; i++) {
                b[i] = cards2[cards2.length - 1 - i];
                System.out.println("0" +(i+1) + b[i]);
            }

        }
    }
}